package com.example.mylianxi;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.widget.ListView;

import java.util.ArrayList;
import java.util.List;

public class MainActivity extends AppCompatActivity {
    private ListView listview1;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        listview1 =findViewById(R.id.listview1);
        List <Bean> list=new ArrayList<>();
        Bean bean = new Bean("宫保鸡丁", "22");
        list.add(bean);
        bean = new Bean("鱼香肉丝","20");
        list.add(bean);
        bean = new Bean("香菇油菜","13");
        list.add(bean);
        bean = new Bean("麻婆豆腐","18");
        list.add(bean);
        bean = new Bean("山西烩菜","18");
        list.add(bean);
        bean = new Bean("剁椒鱼头","18");
        list.add(bean);
         adapter = new MyAdapter(MainActivity.this,list);
        listview1.setAdapter(adapter);


    }
}